//
//  XBSRightDynamicTextCell.m
//  UITest
//
//  Created by user on 2017/5/11.
//  Copyright © 2017年 xbs. All rights reserved.
//

#import "XBSRightDynamicTextCell.h"
#import "DataModel.h"


@interface XBSRightDynamicTextCell()

@property (weak, nonatomic) IBOutlet UILabel *titleLabel;

@property (weak, nonatomic) IBOutlet UILabel *contentLabel;

@end
@implementation XBSRightDynamicTextCell

- (void)awakeFromNib {
    [super awakeFromNib];

    

}


- (void)setModel:(DataModel *)model{
    
    _model = model;
    
    self.contentLabel.text  = model.text;
    self.titleLabel.text = model.title;
    
    if (model.cellHeight == 0) {
        
        [self layoutIfNeeded];
        model.cellHeight = [self systemLayoutSizeFittingSize:CGSizeMake(self.width, 0)].height + 10;
        CGFloat height = ceil(model.cellHeight);
        model.cellHeight = height < 44.0 ? 44.0 : height;
    }

    
}
- (void)drawRect:(CGRect)rect{
    
    [super drawRect:rect];
    
    [[UIColor colorWithHexString:@"#eeeeee"] setFill];
    
    UIRectFill(CGRectMake(12, rect.size.height - 1, rect.size.width - 24, 1));
}


@end
